package com.yh.nio;

import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * @ClassName Demo
 * @Description TODO
 * @Author 0715-YuHao
 * @Date 2020/12/17 15:00
 */
public class Demo {

    public static void main(String[] args) throws Exception {
        FileOutputStream out = new FileOutputStream("hello.txt");
        FileChannel fileChannel = out.getChannel();
        ByteBuffer buffer = ByteBuffer.wrap("hello word".getBytes());
        fileChannel.write(buffer);
        fileChannel.close();
        out.close();
    }
}
